/**   
* @Title: StudentsClassImpl.java 
* @Package cn.hdmis.dao.imp 
* @Description: TODO
* @author pnwazgx@163.com   
* @date 2011-3-28 下午10:28:28 
* @version V1.0   
*/
package cn.hdmis.dao.impl;

import java.io.Serializable;
import org.hibernate.Query;
import cn.hdmis.dao.GradeDao;
import cn.hdmis.entity.Grade;
import cn.hdmis.util.HibernateUtil;

/** 
 * @ClassName: StudentsClassImpl 
 * @Description: TODO
 * @author pnwzgx@163.com
 * @date 2011-3-28 下午10:28:28 
 *  
 */

public class GradeDaoImpl extends BaseDaoImp<Grade> implements GradeDao {

	/* (非 Javadoc) 
	 * <p>Title: addClazz</p> 
	 * <p>Description: </p> 
	 * @param studentsClass 
	 * @see cn.hdmis.dao.StudentsClassDao#addClazz(cn.hdmis.entity.StudentsClass) 
	 */
	public void addGrade(Grade grade) {
		// TODO Auto-generated method stub
		super.saveOrUpdate(grade);

	}

	/* (非 Javadoc) 
	 * <p>Title: removeClazz</p> 
	 * <p>Description: </p> 
	 * @param studentsClass 
	 * @see cn.hdmis.dao.StudentsClassDao#removeClazz(cn.hdmis.entity.StudentsClass) 
	 */
	public void removeGrade(Grade grade) {
		// TODO Auto-generated method stub
		del(grade.getId());
	}
	
	public void del(Grade entity){
		del(entity.getId());
	}
	
	public void del(Serializable id){
		HibernateUtil.beginTransaction();
		Query query = this.getSession().createQuery("update StudentsClass set disabled =:disabled where id =:id");
		query.setBoolean("disabled", true);
		query.setParameter("id", id);
		query.executeUpdate();
		HibernateUtil.commitTransaction();
		
	}
}
